home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
Libraries
/
SpriteEngine
/
SpriteTools.h
< prev
Wrap
Text File
|
1995-03-11
|
2KB
|
56 lines
// SpriteTools.h
#include <QDOffScreen.h>
#include "SpriteHandlers.h"
#define DoError {SysBeep(1);ExitToShell();}
#define abs(x) ((x)>0?(x):-(x))
#define Sgn(x) (x=0?0:(x>0?1:-1))
// Delay constant
#define kFrameTime 1
/* The window pointer */
extern WindowPtr myWindow;
/****************************************/
/* Global variables for sprite handling */
/****************************************/
// EntityType and SpriteRecord are defined in SpriteHandlers.h
typedef SpriteRecord *SpritePtr; /* Define a handle type to it */
/* A global pointer is the root of the entity list */
extern SpritePtr gSpriteList;
/* GWorlds for the animation and background buffers */
extern GrafPtr gOffScreen, gBackScreen;
/*** End of sprite handling variables ***/
// Routines in SpriteTools.c
void MyNewGWorld(GrafPtr *offscreenGWorld, Rect *boundsRect);
GrafPtr LoadFaceFromCicn(short cicnId);
void PlotFace(GrafPtr theCicn, GrafPtr destPort, Point where);
/*Sprite list management*/
SpritePtr NewSprite();
void DisposeSprite(SpritePtr who);
/*Sprite utilities*/
Boolean KeepOnScreen(SpritePtr theSprite);
#ifdef _hasfixedpoint
Boolean KeepOnScreenFixed(SpritePtr theSprite);
#endif
short RectSeparate(SpritePtr theSprite, SpritePtr anotherSprite);
short Rand(short range);
Boolean RegionHit(SpritePtr theSprite, SpritePtr anotherSprite);
void SplitVector(Point v, Point d, Point *p, Point *n);
// Mandatory routines in SpriteHandlers.c
void MoveSprite(SpritePtr theSprite);
void HitSprite(SpritePtr theSprite, SpritePtr anotherSprite);
void InitSprites();